package org.gao.test.transaction.Standalone.LocalDB;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import javax.naming.spi.InitialContextFactoryBuilder;

public class LocalContextFactory implements InitialContextFactory, InitialContextFactoryBuilder{

	private static LocalContext ctx; 
	public InitialContextFactory createInitialContextFactory(
			Hashtable<?, ?> environment) throws NamingException {
		return this;
	}

	public Context getInitialContext(Hashtable<?, ?> environment)
			throws NamingException {
		if(ctx == null) {
			ctx = new LocalContext();
		}
		return ctx;
	}

}
